use the lookup tables to speed up the conversion 8still error of 0.002677
authorØyvind Kolås <ok@src.gnome.org>
Sat, 8 Nov 2008 23:20:29 +0000 (23:20 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Sat, 8 Nov 2008 23:20:29 +0000 (23:20 +0000)
* extensions/gegl-fixups.c: (conv_rgbAF_lrgba8): use the lookup tables
to speed up the conversion 8still error of 0.002677 though).

svn path=/trunk/; revision=354

ChangeLog
extensions/gegl-fixups.c

index 83c1728b87c29114155dca5af41ce60ea59b6573..87a957e5abdb7600998fba6a486378bdb6051c02 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-08  Øyvind Kolås  <pippin@gimp.org>
+
+       * extensions/gegl-fixups.c: (conv_rgbAF_lrgba8): use the lookup tables
+       to speed up the conversion 8still error of 0.002677 though).
+
 2008-11-06  Øyvind Kolås  <pippin@gimp.org>
 
        * extensions/gegl-fixups.c: (conv_rgbAF_rgbaF),
index 72da8ba6adfb84fee61deb8a98b97b416a6de864..20948cb9a0437bf7380866dff693c9c03542fa13 100644 (file)
@@ -488,6 +488,7 @@ conv_rgbAF_rgbaF (unsigned char *srcc,
 }
 
 
+
 static long
 conv_rgbAF_lrgba8 (unsigned char *srcc,
                    unsigned char *dstc,
@@ -500,13 +501,18 @@ conv_rgbAF_lrgba8 (unsigned char *srcc,
   while (n--)
     {
       float alpha = src[3];
-      float recip = (1.0/alpha)*255.0;
+      float recip = (1.0/alpha);
       if (alpha < 0.00001)
-        recip = 0.0;
-      dst[0] = (src[0] * recip);
-      dst[1] = (src[1] * recip);
-      dst[2] = (src[2] * recip);
-      dst[3] = alpha*255.0;
+        {
+          dst[0] = dst[1] = dst[2] = dst[3] = 0;
+        }
+      else
+        {
+          dst[0] = table_F_8[gggl_float_to_index16 (src[0] * recip)];
+          dst[1] = table_F_8[gggl_float_to_index16 (src[1] * recip)];
+          dst[2] = table_F_8[gggl_float_to_index16 (src[2] * recip)];
+          dst[3] = table_F_8[gggl_float_to_index16 (alpha)];
+        }
       src   += 4;
       dst   += 4;
     }